package myapp.mvc_pattern;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.Observable;

import android.util.Log;

public class PersonList extends  Observable {

	private List<Person> personList;
	
	public PersonList () {
		this.personList = new ArrayList<Person>();
	}
	
	public void addPersonToList (Person p) {
		personList.add(p);
		setChanged();
		notifyObservers();
	}
	
	public List<Person> getPersonList () {
		return this.personList;
	}
	
	public void setPersonList (List<Person> pList) {
		this.personList = pList;
	}
	
	
	public void deleteList () {
		personList.clear();
	}
	
	public void deletePerson (Person p) {
		personList.remove(p);
		setChanged();
		notifyObservers();
	}
}
